package by.bsu.touragency.db.beans;

import java.util.regex.Matcher;
import java.util.regex.Pattern;

public class Country {
	private int id;
	private String countryName;
	private String about;
	private boolean visa;

	public Country() {
		super();
	}

	public int getId() {
		return id;
	}

	public void setId(int id) {
		this.id = id;
	}

	public String getCountryName() {
		return countryName;
	}

	public void setCountryName(String countryName) {
		if (isValidCountryName(countryName)) 
			this.countryName = countryName;
	}

	public String getAbout() {
		return about;
	}

	public void setAbout(String about) {
		this.about = about;
	}

	public boolean getVisa() {
		return visa;
	}

	public void setVisa(boolean visa) {
		this.visa = visa;
	}

	public boolean isValidCountryName(String countryName) {
		if (countryName != "" & countryName != null
				&& countryName.length() < 50) {
			Pattern p = Pattern.compile("([A-Z])*([a-z])+");
			Matcher m = p.matcher(countryName);
			return m.matches();
		} else
			return false;
	}
}
